connectToVadb <- function (user="va", dbname="va_stratlab", host="localhost", pwd=NULL) {
  # set default password
  password <- "dummy"
  # set password out of .dbstring environment
  #if (!is.character(pwd)) {
  #  if (is.environment(.dbstring) {
  #    if (is.character (.dbstring$dbstring)) {
  #      password <- .dbstring$dbstring
  #    }
  #  }
  #}
  
  # load DBI and RMySQL packages
  if('package:DBI' %in% search() || require('DBI',quietly=TRUE)) {
    if('package:RMySQL' %in% search() || require('RMySQL',quietly=TRUE)) {
    } else { 
      warning(paste("package:",dQuote("RMySQL"),"cannot be loaded" )) 
    }
  } else {
    stop(paste("package:",dQuote('DBI'),"cannot be loaded."))
  }
  # connect to database
  con <- dbConnect(MySQL(), user=user, password=password, dbname=dbname, host=host)
  return(con)
}



disconnectFromVadb <- function(con) {
  dbDisconnect(con)
}